package com.dao.impl;

import com.bean.Grade;
import com.bean.Role;
import com.dao.DBUtils;
import com.dao.RoleDao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class RoleDaoImpl extends DBUtils implements RoleDao {
    public List<Role> getList() {
        List rs = new ArrayList();
        try {
            String sql = "select * from role";
            resultSet = query(sql, null);
            while (resultSet.next()){
                Role role = new Role();
                role.setRoleId(resultSet.getInt("roleid"));
                role.setRoleName(resultSet.getString("rolename"));
                rs.add(role);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {
            closeAll();
        }
        return rs;
    }
}
